import request from '@/utils/request'

// 查询基金费用列表
export function listFundExpense(query) {
  return request({
    url: '/expense/fundExpense/list',
    method: 'get',
    params: query
  })
}

// 查询基金费用列表合计
export function getFundExpenseSum(query) {
  return request({
    url: '/expense/fundExpense/getSum',
    method: 'get',
    params: query
  })
}

// 查询基金费用列表
export function statisticalList(query) {
  return request({
    url: '/expense/fundExpense/statistical/list',
    method: 'get',
    params: query
  })
}
export function statisticalListByLp(query) {
  return request({
    url: '/expense/fundExpense/statistical/listByLp',
    method: 'get',
    params: query
  })
}

export function listFundExpenseByResult(query) {
  return request({
    url: '/expense/fundExpense/listByResult',
    method: 'get',
    params: query
  })
}

export function getFundExpenseByResultSum(query) {
  return request({
    url: '/expense/fundExpense/getByResultSum',
    method: 'get',
    params: query
  })
}

// 查询基金费用详细
export function getFundExpense(id) {
  return request({
    url: '/expense/fundExpense/' + id,
    method: 'get'
  })
}

// 保存基金费用
export function saveFundExpense(data) {
  return request({
    url: '/expense/fundExpense/save',
    method: 'post',
    data: data
  })
}

// 批量保存基金费用
export function saveBatchFundExpense(data) {
  return request({
    url: '/expense/fundExpense/batchSave',
    method: 'post',
    data: data
  })
}

// 删除基金费用
export function delFundExpense(id) {
  return request({
    url: '/expense/fundExpense/' + id,
    method: 'delete'
  })
}

// 导出基金费用
export function exportFundExpense(query) {
  return request({
    url: '/expense/fundExpense/export',
    method: 'get',
    params: query
  })
}

// 维护付款时间
export function updatePayTime(id, payCompletionTime) {
  const data = {
    id,
    payCompletionTime
  }
  return request({
    url: '/expense/fundExpense/updatePayTime',
    method: 'post',
    data: data
  })
}

// 根据基金ID查询费用金额之和
export function sumFundExpense(fundId) {
  return request({
    url: '/expense/fundExpense/sumFundExpense/' + fundId,
    method: 'get'
  })
}
